import request from '@/utils/request'

// eslint-disable-next-line camelcase
export function fetchCommentsByTopicId (topic_Id) { // 查询这篇id的文章里面的评论
  return request({
    url: '/comment/get_comments',
    method: 'get',
    params: {
      topicid: topic_Id
    }
  })
}

// eslint-disable-next-line camelcase
export function getParentCom (parent_id) { // 根据父级id的她的评论
  return request({
    url: '/comment/get_ParentCom',
    method: 'get',
    params: {
      parentid: parent_id
    }
  })
}

// eslint-disable-next-line camelcase
export function getParentCom2 (item_id) { // 根据父级id的她的评论
  return request({
    url: '/comment/get_ParentCom',
    method: 'get',
    params: {
      itemid: item_id
    }
  })
}

export function pushComment (data) { // 根据数组数据请求插入评论
  return request({
    url: '/comment/add_comment',
    method: 'post',
    data: data
  })
}

export function pushParentComt (data2) {
  return request({
    url: '/comment/add_ParentCom',
    method: 'post',
    data: data2
  })
}

export function deleteComments (id) {
  return request({
    url: `/comment/deleteComments/${id}`,
    method: 'delete'
  })
}

export function deletePComments (parentId) {
  return request({
    url: `/comment/deletePCComments/${parentId}`,
    method: 'delete'
    // params: {
    //   parentId: parentId
    // }
  })
}
